package com.thjk.bdf.preloan.service.domain.domainservice;

import com.thjk.bdf.common.entity.CheckFailLog;
import com.thjk.bdf.common.utils.UidGenerator;
import com.thjk.bdf.preloan.service.config.AppConfig;
import com.thjk.bdf.preloan.service.repository.dao.CheckFailLogMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
public class CheckFailLogService {
    private static final Logger logger = LoggerFactory.getLogger(CheckFailLogService.class);

    @Autowired
    private CheckFailLogMapper checkFailLogMapper;

    @Autowired
    private AppConfig appConfig;

    @Transactional(propagation = Propagation.REQUIRED)
    public void insertCheckFailLog(CheckFailLog checkFailLog) {
        String recordNo = UidGenerator.generateId(appConfig.getAppIp());
        checkFailLog.setRecordNo(recordNo);
        checkFailLog.setCreateTime(new Date());
        checkFailLogMapper.insertSelective(checkFailLog);
        logger.info("success");
    }

}
